package com.ymm.system.core.jobs;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.ymm.system.api.facade.SystemCargoService;
import com.ymm.system.api.facade.SystemOrderService;
import com.ymm.system.dao.mapper.CargoMapper;
import com.ymm.system.dao.mapper.LltorderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

/**
 * @auther ZhangHongyuan
 * @date 2022/8/17 11:29
 */

@Component
public class AutoConfirmOrderScheduledJob {

    @Autowired
    private SystemOrderService systemOrderService;

    @Resource
    private LltorderMapper lltorderMapper;

    @XxlJob("autoConfirmOrderScheduledJob")
    public ReturnT testTask(String param) throws Exception {
        List<Long> dischargedOutTimeOrderIds = lltorderMapper.listDischargedOutTimeOrderId();
        for (Long dischargedOutTimeOrderId : dischargedOutTimeOrderIds) {
            systemOrderService.confirmReceipt(dischargedOutTimeOrderId, 3, null);
        }
        return ReturnT.SUCCESS;
    }
}
